﻿#include "coder.h"
#include "ui_coder.h"

Coder::Coder(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Coder)
{
    ui->setupUi(this);
}

Coder::~Coder()
{
    delete ui;
}

void Coder::on_btn_search_clicked()
{
    code=ui->code_in->text().trimmed();
    if(code.isEmpty())
        return;
    QSqlQuery query;
    query.exec(QString("select name from td_code where code = '%1'").arg(code));
    if(query.next())
    {
        name=query.value(0).toString();
        ui->lbl_display->setText(name);
    }
    else
        ui->lbl_display->setText(QStringLiteral("没有找到相应产品！"));
}
